/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cx1.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang.StringUtils;

/**
 *
 * @author ECH
 */
public class Listing extends Base implements Serializable {
    
    private static final long serialVersionUID = 1;
            
    private String title;
    private String description;
    private String notes;
    
    private String country;
    private String region;
    private String city;
    private String barangay;
    private String street;
    private String structure;
    private String number;
    private String floor;
    private String zip;
    
    private String lat;
    private String lng;
    
    private String dayRate = "0";
    private String weekRate = "0";
    private String monthRate = "0";
    private String yearRate = "0";
        
    private boolean leaseShortTerm;
    private boolean leaseLongTerm;
    
    private String longDayRate = "0";
    private String longWeekRate = "0";
    private String longMonthRate = "0";
    private String longYearRate = "0";
    
    private String shortDayRate = "0";
    private String shortWeekRate = "0";
    private String shortMonthRate = "0";
    private String shortYearRate = "0";
    
    private float longMonthRateNum;
    
    private float shortMonthRateNum;
    private float shortWeekRateNum;
    private float shortDayRateNum;
    
    private String sellingPrice = "0";
    
    private double sqArea = 0.0;
    
    private int numBedrooms = 0;
    private int numBathrooms = 0;
    
    private Date availabilityDate;
    private Date leaseStartDate;
    private Date leaseEndDate;
    
    private Date postDate;
    private Date expiryDate;
    private Date spawnDate;
    
    private boolean available;                               
    private boolean verified;        
    private boolean posted;    
    private boolean penalized;
    
    private long impressions;
    private long views;
    
    //CX: references to objects
    
    private String propertyTypeID;    
    private String statusTypeID;
    private String posterTypeID;
    private String furnishTypeID;
        
    private String creatorID;
    
    //CX: roomorama attributes
        
    private String roomorama_id;
    private String roomorama_shortDayRateUSD;
    
    private boolean roomoramaListing;
    
    private List<String> photoIDs = new ArrayList<String>(0);    
    private List<String> placeIDs = new ArrayList<String>(0);
    private List<String> amenityIDs = new ArrayList<String>(0);
    
    //x
    private String primaryPhotoID;
    //x
    private List<String> contactPersonIDs = new ArrayList<String>(0);    
    //x
    private List<String> companyIDs = new ArrayList<String>(0);
    
    
    //CX: referenced objects
    
    private PropertyType propertyType;    
    private StatusType statusType;
    private PosterType posterType;
    private FurnishType furnishType;
    
    //x
    private Photo primaryPhoto;   
    
    private List<Photo> photos = new ArrayList<Photo>(0); 
    
    private List<Place> places = new ArrayList<Place>(0);
    private List<Amenity> amenities = new ArrayList<Amenity>(0);
    
    //x
    private List<User> contactPersons = new ArrayList<User>(0);    
    //x
    private List<Company> companies = new ArrayList<Company>(0);
    
    private User creator;     
    
    //CX: view attributes
    
    private String urlTitle;
    private String displayTitle;
    private String displayDescription;
    private String displayShortDescription;
    
    private String address;
    private String shortAddress;
    
    private Place community;
    private Place city_place;
    
    //CX: featured attributes for display
    private boolean featured;
    private boolean longTerm_featured;
    private boolean shortTerm_featured;
    private String city_featured;
    private Date startDate_featured;
    private Date endDate_featured;
    
    public Listing() {
        
    }

    public Listing(String propertyTypeID, String title, String description) {
        this.propertyTypeID = propertyTypeID;
        this.title = title;
        this.description = description;
    }
    
    public Listing(String id, String propertyTypeID, String title, String description) {
        this.setId(id);
        this.propertyTypeID = propertyTypeID;
        this.title = title;
        this.description = description;
    }
    
    public String getPropertyTypeID() {
        return propertyTypeID;
    }

    public void setPropertyTypeID(String propertyTypeID) {
        this.propertyTypeID = propertyTypeID;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getLng() {
        return lng;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public String getDayRate() {
        return dayRate;
    }

    public void setDayRate(String dayRate) {
        this.dayRate = dayRate;
    }

    public String getWeekRate() {
        return weekRate;
    }

    public void setWeekRate(String weekRate) {
        this.weekRate = weekRate;
    }

    public String getMonthRate() {
        return monthRate;
    }

    public void setMonthRate(String monthRate) {
        this.monthRate = monthRate;
    }

    public String getYearRate() {
        return yearRate;
    }

    public void setYearRate(String yearRate) {
        this.yearRate = yearRate;
    }

    public boolean isAvailable() {
        return available;
    }

    public void setAvailable(boolean available) {
        this.available = available;
    }

    public Photo getPrimaryPhoto() {
        return primaryPhoto;
    }

    public void setPrimaryPhoto(Photo primaryPhoto) {
        this.primaryPhoto = primaryPhoto;
    }

    public List<Photo> getPhotos() {
        return photos;
    }

    public void setPhotos(List<Photo> photos) {
        this.photos = photos;
    }

    public List<Place> getPlaces() {
        return places;
    }

    public void setPlaces(List<Place> places) {
        this.places = places;
    }

    public List<Amenity> getAmenities() {
        return amenities;
    }

    public void setAmenities(List<Amenity> amenities) {
        this.amenities = amenities;
    }

    public User getCreator() {
        return creator;
    }

    public void setCreator(User creator) {
        this.creator = creator;
    }

    public List<Company> getCompanies() {
        return companies;
    }

    public void setCompanies(List<Company> companies) {
        this.companies = companies;
    }

    public Date getLeaseStartDate() {
        return leaseStartDate;
    }

    public void setLeaseStartDate(Date leaseStartDate) {
        this.leaseStartDate = leaseStartDate;
    }

    public Date getLeaseEndDate() {
        return leaseEndDate;
    }

    public void setLeaseEndDate(Date leaseEndDate) {
        this.leaseEndDate = leaseEndDate;
    }

    public List<User> getContactPersons() {
        return contactPersons;
    }

    public void setContactPersons(List<User> contactPersons) {
        this.contactPersons = contactPersons;
    }

    public String getPrimaryPhotoID() {
        return primaryPhotoID;
    }
    
    public void setPrimaryPhotoID(String primaryPhotoID) {
        this.primaryPhotoID = primaryPhotoID;
    }

    public List<String> getPhotoIDs() {
        return photoIDs;
    }

    public void setPhotoIDs(List<String> photoIDs) {
        this.photoIDs = photoIDs;
    }

    public List<String> getPlaceIDs() {
        return placeIDs;
    }

    public void setPlaceIDs(List<String> placeIDs) {
        this.placeIDs = placeIDs;
    }

    public List<String> getAmenityIDs() {
        return amenityIDs;
    }

    public void setAmenityIDs(List<String> amenityIDs) {
        this.amenityIDs = amenityIDs;
    }

    public List<String> getContactPersonIDs() {
        return contactPersonIDs;
    }

    public void setContactPersonIDs(List<String> contactPersonIDs) {
        this.contactPersonIDs = contactPersonIDs;
    }

    public List<String> getCompanyIDs() {
        return companyIDs;
    }

    public void setCompanyIDs(List<String> companyIDs) {
        this.companyIDs = companyIDs;
    }

    public double getSqArea() {
        return sqArea;
    }

    public void setSqArea(double sqArea) {
        this.sqArea = sqArea;
    }

    public int getNumBedrooms() {
        return numBedrooms;
    }

    public void setNumBedrooms(int numBedrooms) {
        this.numBedrooms = numBedrooms;
    }

    public int getNumBathrooms() {
        return numBathrooms;
    }

    public void setNumBathrooms(int numBathrooms) {
        this.numBathrooms = numBathrooms;
    }

    public PropertyType getPropertyType() {
        return propertyType;
    }

    public void setPropertyType(PropertyType propertyType) {
        this.propertyType = propertyType;
    }

    public String getCreatorID() {
        return creatorID;
    }

    public void setCreatorID(String creatorID) {
        this.creatorID = creatorID;
    }

    public Date getAvailabilityDate() {
        return availabilityDate;
    }

    public void setAvailabilityDate(Date availabilityDate) {
        this.availabilityDate = availabilityDate;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }

    public String getBarangay() {
        return barangay;
    }

    public void setBarangay(String barangay) {
        this.barangay = barangay;
    }

    public String getStructure() {
        return structure;
    }

    public void setStructure(String structure) {
        this.structure = structure;
    }

    public String getFloor() {
        return floor;
    }

    public void setFloor(String floor) {
        this.floor = floor;
    }

    public boolean isVerified() {
        return verified;
    }

    public void setVerified(boolean verified) {
        this.verified = verified;
    }

    public Date getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(Date expiryDate) {
        this.expiryDate = expiryDate;
    }

    public String getStatusTypeID() {
        return statusTypeID;
    }

    public void setStatusTypeID(String statusTypeID) {
        this.statusTypeID = statusTypeID;
    }

    public StatusType getStatusType() {
        return statusType;
    }

    public void setStatusType(StatusType statusType) {
        this.statusType = statusType;
    }

    public String getSellingPrice() {
        return sellingPrice;
    }

    public void setSellingPrice(String sellingPrice) {
        this.sellingPrice = sellingPrice;
    }

    public String getPosterTypeID() {
        return posterTypeID;
    }

    public void setPosterTypeID(String posterTypeID) {
        this.posterTypeID = posterTypeID;
    }

    public PosterType getPosterType() {
        return posterType;
    }

    public void setPosterType(PosterType posterType) {
        this.posterType = posterType;
    }

    public String getShortAddress() {
        return shortAddress;
    }

    public void setShortAddress(String shortAddress) {
        this.shortAddress = shortAddress;
    }

    public FurnishType getFurnishType() {
        return furnishType;
    }

    public void setFurnishType(FurnishType furnishType) {
        this.furnishType = furnishType;
    }

    public String getFurnishTypeID() {
        return furnishTypeID;
    }

    public void setFurnishTypeID(String furnishTypeID) {
        this.furnishTypeID = furnishTypeID;
    }

    public String getDisplayTitle() {
        return displayTitle;
    }

    public void setDisplayTitle(String displayTitle) {
        this.displayTitle = displayTitle;
    }

    public String getDisplayDescription() {
        return displayDescription;
    }

    public void setDisplayDescription(String displayDescription) {
        this.displayDescription = displayDescription;
    }

    public Date getPostDate() {
        return postDate;
    }

    public void setPostDate(Date postDate) {
        this.postDate = postDate;
    }

    public boolean isPosted() {
        return posted;
    }

    public void setPosted(boolean posted) {
        this.posted = posted;
    }

    public String getUrlTitle() {
        return urlTitle;
    }

    public void setUrlTitle(String urlTitle) {
        this.urlTitle = urlTitle;
    }

    public boolean isLeaseShortTerm() {
        return leaseShortTerm;
    }

    public void setLeaseShortTerm(boolean leaseShortTerm) {
        this.leaseShortTerm = leaseShortTerm;
    }

    public boolean isLeaseLongTerm() {
        return leaseLongTerm;
    }

    public void setLeaseLongTerm(boolean leaseLongTerm) {
        this.leaseLongTerm = leaseLongTerm;
    }

    public String getLongDayRate() {
        return longDayRate;
    }

    public void setLongDayRate(String longDayRate) {
        this.longDayRate = longDayRate;
    }

    public String getLongWeekRate() {
        return longWeekRate;
    }

    public void setLongWeekRate(String longWeekRate) {
        this.longWeekRate = longWeekRate;
    }

    public String getLongMonthRate() {
        return longMonthRate;
    }

    public void setLongMonthRate(String longMonthRate) {
        this.longMonthRate = longMonthRate;
    }

    public String getLongYearRate() {
        return longYearRate;
    }

    public void setLongYearRate(String longYearRate) {
        this.longYearRate = longYearRate;
    }

    public String getShortDayRate() {
        return shortDayRate;
    }

    public void setShortDayRate(String shortDayRte) {
        this.shortDayRate = shortDayRte;
    }

    public String getShortWeekRate() {
        return shortWeekRate;
    }

    public void setShortWeekRate(String shortWeekRate) {
        this.shortWeekRate = shortWeekRate;
    }

    public String getShortMonthRate() {
        return shortMonthRate;
    }

    public void setShortMonthRate(String shortMonthRate) {
        this.shortMonthRate = shortMonthRate;
    }

    public String getShortYearRate() {
        return shortYearRate;
    }

    public void setShortYearRate(String shortYearRate) {
        this.shortYearRate = shortYearRate;
    }
       
    @Override
    public boolean equals(Object obj) {
        boolean equals = false;
        if (obj instanceof Listing) {
            Listing p1 = (Listing) obj;
            if (StringUtils.equals(this.getId(), p1.getId())) {
                equals = true;
            }
        }
        return equals;
    }

    @Override
    public int hashCode() {
        return 0;
    }

    public boolean isRoomoramaListing() {
        return roomoramaListing;
    }

    public void setRoomoramaListing(boolean roomoramaListing) {
        this.roomoramaListing = roomoramaListing;
    }

    public String getRoomorama_id() {
        return roomorama_id;
    }

    public void setRoomorama_id(String roomorama_id) {
        this.roomorama_id = roomorama_id;
    }

    public String getRoomorama_shortDayRateUSD() {
        return roomorama_shortDayRateUSD;
    }

    public void setRoomorama_shortDayRateUSD(String roomorama_shortDayRateUSD) {
        this.roomorama_shortDayRateUSD = roomorama_shortDayRateUSD;
    }

    public String getDisplayShortDescription() {
        return displayShortDescription;
    }

    public void setDisplayShortDescription(String displayShortDescription) {
        this.displayShortDescription = displayShortDescription;
    }

    public Place getCommunity() {
        return community;
    }

    public void setCommunity(Place community) {
        this.community = community;
    }

    public boolean isPenalized() {
        return penalized;
    }

    public void setPenalized(boolean penalized) {
        this.penalized = penalized;
    }

    public long getImpressions() {
        return impressions;
    }

    public void setImpressions(long impressions) {
        this.impressions = impressions;
    }

    public long getViews() {
        return views;
    }

    public void setViews(long views) {
        this.views = views;
    }

    public float getLongMonthRateNum() {
        return longMonthRateNum;
    }

    public void setLongMonthRateNum(float longMonthRateNum) {
        this.longMonthRateNum = longMonthRateNum;
    }

    public float getShortMonthRateNum() {
        return shortMonthRateNum;
    }

    public void setShortMonthRateNum(float shortMonthRateNum) {
        this.shortMonthRateNum = shortMonthRateNum;
    }

    public float getShortWeekRateNum() {
        return shortWeekRateNum;
    }

    public void setShortWeekRateNum(float shortWeekRateNum) {
        this.shortWeekRateNum = shortWeekRateNum;
    }

    public float getShortDayRateNum() {
        return shortDayRateNum;
    }

    public void setShortDayRateNum(float shortDayRateNum) {
        this.shortDayRateNum = shortDayRateNum;
    }

    public Place getCity_place() {
        return city_place;
    }

    public void setCity_place(Place city_place) {
        this.city_place = city_place;
    }

    public boolean isFeatured() {
        return featured;
    }

    public void setFeatured(boolean featured) {
        this.featured = featured;
    }

    public String getCity_featured() {
        return city_featured;
    }

    public void setCity_featured(String city_featured) {
        this.city_featured = city_featured;
    }

    public Date getStartDate_featured() {
        return startDate_featured;
    }

    public void setStartDate_featured(Date startDate_featured) {
        this.startDate_featured = startDate_featured;
    }

    public Date getEndDate_featured() {
        return endDate_featured;
    }

    public void setEndDate_featured(Date endDate_featured) {
        this.endDate_featured = endDate_featured;
    }

    public boolean isLongTerm_featured() {
        return longTerm_featured;
    }

    public void setLongTerm_featured(boolean longTerm_featured) {
        this.longTerm_featured = longTerm_featured;
    }

    public boolean isShortTerm_featured() {
        return shortTerm_featured;
    }

    public void setShortTerm_featured(boolean shortTerm_featured) {
        this.shortTerm_featured = shortTerm_featured;
    }

    public Date getSpawnDate() {
        return spawnDate;
    }

    public void setSpawnDate(Date spawnDate) {
        this.spawnDate = spawnDate;
    }
}
